﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace USMC.Net
{
    public class CycleInfo
    {
        public PointControl CycleStart { get; set; }
        public PointControl CycleEnd { get; set; }
        public int Iterations { get; set; }
        public CycleInfo(PointControl start, PointControl end, int iterations)
        {
            if (start == end)
                throw new InvalidOperationException("Начало цикла совпадает с концом");
            CycleStart = start;
            CycleEnd = end;
            Iterations = iterations;
            CycleStart.AddCycle(this);
            CycleEnd.AddCycle(this);
        }
        public CycleInfo()
        {
        }
        public void BreakCycle()
        {
            CycleStart.RemoveCycle(this);
            CycleEnd.RemoveCycle(this);
            CycleEnd = null;
            CycleStart = null;
        }
    }
}
